import request from '@/utils/request'
import Qs from 'qs'

// 上传图片

export function uploadImage (file) {
  return request({
    url: '/common/interface/upload_img',
    method: 'post',
    data: file
  })
}

// 登录
export function toLogin (data) {
  return request({
    url: '/sysUser/login',
    method: 'post',
    data
  })
}

// 登录
export function getCode (params) {
  return request({
    url: '/sysUser/getLoginCode',
    method: 'get',
    params
  })
}

// 添加水印
export function addWater (title) {
  return request({
    url: '/admin/watermark/add_watermark',
    method: 'post',
    data: {
      title
    }
  })
}

// 刷新时间
export function getRefreshTime () {
  return request({
    url: '/admin/web/time/query_webTimeDetail',
    method: 'post'
  })
}

export function updateRefreshTime (data) {
  return request({
    url: '/admin/web/time/update_webTime',
    method: 'post',
    data
  })
}

// 获取数据时间
export function getDataDate () {
  return request({
    url: '/admin/time/settings/query_timeSettingsDetail',
    method: 'post'
  })
}

// 更新数据时间
export function updateDataDate (data) {
  return request({
    url: '/admin/time/settings/update_dataManagementTimeSettings',
    method: 'post',
    data
  })
}

// 短信接口
export function getMsgIfPage (data) {
  return request({
    url: '/admin/message/get_message',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function updateMsgIf (data) {
  return request({
    url: '/admin/message/update_message',
    method: 'post',
    data
  })
}

export function addMsgIf (data) {
  return request({
    url: '/admin/message/add_message',
    method: 'post',
    data
  })
}

export function delMsgIf (id) {
  return request({
    url: '/admin/message/delete_message',
    method: 'post',
    data: {
      id
    }
  })
}

// 用户接口
export function getUserPage (data) {
  return request({
    url: '/admin/user/get_user',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function readUser (id) {
  return request({
    url: '/admin/user/query_userDetail',
    method: 'post',
    data: Qs.stringify({
      id
    })
  })
}

export function updateUser (data) {
  return request({
    url: '/admin/user/update_user',
    method: 'post',
    data
  })
}

export function updateUserStatus (data) {
  return request({
    url: '/admin/user/update_userstatus',
    method: 'post',
    data
  })
}

export function addUser (data) {
  return request({
    url: '/admin/user/add_user',
    method: 'post',
    data
  })
}

export function delUser (id, params = {}) {
  return request({
    url: '/admin/user/delete_user',
    method: 'post',
    data: {
      id,
      ...params
    }
  })
}

// 菜单接口
export function getMenuPage (data) {
  return request({
    url: '/admin/MenusInfo/get_MenusInfo',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function getMenuList () {
  return request({
    url: '/admin/MenusInfo/query_menuList',
    method: 'post'
  })
}

export function getMenuFloor () {
  return request({
    url: '/admin/MenusInfo/select_superiorMenu',
    method: 'post'
  })
}

export function updateMenu (data) {
  return request({
    url: '/admin/MenusInfo/update_MenusInfo',
    method: 'post',
    data
  })
}

export function updateMenuStatus (data) {
  return request({
    url: '/admin/MenusInfo/update_MenusInfoStatus',
    method: 'post',
    data
  })
}

export function addMenu (data) {
  return request({
    url: 'admin/MenusInfo/add_superiorMenu',
    method: 'post',
    data
  })
}

export function addNextMenu (data) {
  return request({
    url: '/admin/MenusInfo/add_lowerMenu',
    method: 'post',
    data
  })
}

export function delMenu (id) {
  return request({
    url: '/admin/MenusInfo/delete_MenusInfo',
    method: 'post',
    data: {
      id
    }
  })
}

// 角色接口
export function getRolePage (data) {
  return request({
    url: '/admin/RoleInfo/get_roleInfo',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function getRoleList () {
  return request({
    url: '/admin/role/get_role',
    method: 'post'
  })
}

export function readRoleDetail (id) {
  return request({
    url: '/admin/RoleInfo/query_roleDetails',
    method: 'post',
    data: Qs.stringify({ id })
  })
}

export function updateRole (data) {
  return request({
    url: '/admin/RoleInfo/update_roleInfo',
    method: 'post',
    data
  })
}

export function updateRoleStatus (data) {
  return request({
    url: '/admin/RoleInfo/update_RoleInfoStatus',
    method: 'post',
    data
  })
}

export function addRole (data) {
  return request({
    url: '/admin/RoleInfo/add_roleInfo',
    method: 'post',
    data
  })
}

export function delRole (id) {
  return request({
    url: '/admin/RoleInfo/delete_roleInfo',
    method: 'post',
    data: {
      id
    }
  })
}

export function bindRolePermission (data) {
  return request({
    url: '/admin/RoleInfo/add_rolePermissions',
    method: 'post',
    data
  })
}

export function bindRoleMenu (data) {
  return request({
    url: '/admin/RoleInfo/add_roleMenusInfo',
    method: 'post',
    data
  })
}

// 区域
export function getRegionList () {
  return request({
    url: '/admin/address/get_address',
    method: 'post'
  })
}

// 部门
export function getDepartPage (data) {
  return request({
    url: '/admin/depart/get_depart',
    method: 'post',
    data: Qs.stringify(data)
  })
}

// 部门
export function getDepartIsNot (data) {
  return request({
    url: '/admin/depart/get_departIsNot',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function readDepartDetail (data) {
  return request({
    url: '/admin/depart/get_departdetails',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function readDepar (data) {
  return request({
    url: '/admin/depart/get_departid',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function delDepartUser (id) {
  return request({
    url: '/admin/depart/delete_departuser',
    method: 'post',
    data: {
      id
    }
  })
}

export function updateDepart (data) {
  return request({
    url: '/admin/depart/update_depart',
    method: 'post',
    data
  })
}

export function addDepart (data) {
  return request({
    url: '/admin/depart/add_depart',
    method: 'post',
    data
  })
}

export function delDepart (id) {
  return request({
    url: '/admin/depart/delete_depart',
    method: 'post',
    data: {
      id
    }
  })
}

// 模块
export function getModalPage (data) {
  return request({
    url: '/admin/ModelsInfo/select_modelsList',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function getModalList () {
  return request({
    url: '/admin/ModelsInfo/query_modelsList',
    method: 'post'
  })
}

export function getModalFloor () {
  return request({
    url: '/admin/ModelsInfo/select_modules',
    method: 'post'
  })
}

export function updateModal (data) {
  return request({
    url: '/admin/ModelsInfo/update_ModelsInfo',
    method: 'post',
    data
  })
}

export function updateModalStatus (data) {
  return request({
    url: '/admin/ModelsInfo/update_ModelsInfoStatus',
    method: 'post',
    data
  })
}

export function addModal (data) {
  return request({
    url: 'admin/ModelsInfo/add_modelsInfo',
    method: 'post',
    data
  })
}

export function delModal (id) {
  return request({
    url: '/admin/ModelsInfo/delete_ModelsInfo',
    method: 'post',
    data: {
      id
    }
  })
}

// 日志
export function getLoginLog (data) {
  return request({
    url: '/admin/login/log/query_loginLogList',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function getHandleLog (data) {
  return request({
    url: '/admin/operation/log/query_OperationLogList',
    method: 'post',
    data: Qs.stringify(data)
  })
}

export function getUserInfo () {
  return request({
    url: '/common/interface/get_user_permissionGroup',
    method: 'post'
  })
}

export function updateUserPassword (data) {
  return request({
    url: '/user/manger/update_userPassword',
    method: 'post',
    data
  })
}

export function updateUserPasswordByAdmin (data) {
  return request({
    url: '/user/manger/update_password',
    method: 'post',
    data
  })
}

// ------------- 指令回复 --------------
// 后台查询当前用户所涉及到的事件
export function getEventByUserId (data) {
  return request({
    url: '/admin/order/get_eventByUserId',
    method: 'post',
    data: Qs.stringify(data)
  })
}

// 查询提问接口
export function getAskContent (data) {
  return request({
    url: '/admin/order/get_askContent',
    method: 'post',
    data: Qs.stringify(data)
  })
}
// 查询回复接口
export function getReplyContent (data) {
  return request({
    url: '/admin/order/get_replyContent',
    method: 'post',
    data: Qs.stringify(data)
  })
}
// 回复
export function addReplyContent (data) {
  return request({
    url: '/admin/order/add_replyContent',
    method: 'post',
    data
  })
}

export function getWater (params) {
  return request({
    url: '/admin/watermark/get_watermark',
    method: 'get',
    params
  })
}

// 
export function getLogSearch (params) {
  return request({
    url: '/admin/operation/log/get_operationLogsTitle',
    method: 'get',
    params
  })
}
// 
// export function getAskContent (data) {
//   return request({
//     url: '/admin/order/get_askContent',
//     method: 'post',
//     data
//   })
// }
// ------------- 指令回复 --------------
